package com.lumlord.common.domain.log.monitor;

import java.io.Serializable;

import com.lumlord.common.annotation.mybatis.SqlInjection;
import com.lumlord.common.annotation.mybatis.SqlInjectionColumn;
import com.lumlord.common.annotation.mybatis.SqlInjectionType;
import com.lumlord.common.annotation.pojo.IgnoreColumn;
import com.lumlord.common.annotation.pojo.PK;
import com.lumlord.common.annotation.pojo.Table;
import com.lumlord.common.base.BaseEntity;
import com.lumlord.service.LumlordLogService;
import com.lumlord.util.DateUtils;

import java.util.Date;
import java.lang.Integer;


/**
 * 故障表 Breakdown
 *
 * @author gpf_自动生成
 * @email 372138617@qq.com
 * @date 2019-11-05 09:15:15
 */
@Table(value = "t_breakdown", DB = "gk_monitor_server")
public class Breakdown extends BaseEntity implements Serializable {
    @IgnoreColumn
    private static final long serialVersionUID = 1L;


    /**
     * 主键ID，自增
     **/
    @PK("id")
    private Integer id;

    /**
     * 区域ID
     **/
    private Integer areaId;

    /** 添加时间 **/
    @SqlInjection(types = SqlInjectionType.INSERT, column = SqlInjectionColumn.DEF,defval= DateUtils.DATE_PATTERN)
    private String addDay;



    /**
     * 强弱电类型（1强电；2弱电）
     **/
    private Integer type;

    /**
     * 节点ID（强弱电的节点主键）
     **/
    private Integer nodeId;

    /**
     * 节点状态（1在线；2离线，发生的时候的状态）
     **/
    private Integer nodeStatus;

    /**
     * 数据源IP
     **/
    private String sourceIp;

    /**
     * 故障等级（1重大；2严重；3轻度；）
     **/
    private Integer brakLevel;

    /**
     * 故障类型（1设备故障；2通讯故障；3回路故障；4灯具效果故障；5其他故障）
     **/
    private Integer brakType;

    /**
     * 故障原因
     **/
    private String description;

    /**
     * 故障发生时间
     **/
    @SqlInjection(types = SqlInjectionType.INSERT, column = SqlInjectionColumn.DATE)
    private Date occurredTime;

    /**
     * 是否已读（1已读；0未读/默认）
     **/
    @SqlInjection(types = {SqlInjectionType.INSERT}, defval = "0")
    private Integer isRead;


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }


    public Integer getAreaId() {
        return areaId;
    }

    public void setAreaId(Integer areaId) {
        this.areaId = areaId;
    }


    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }


    public Integer getNodeId() {
        return nodeId;
    }

    public void setNodeId(Integer nodeId) {
        this.nodeId = nodeId;
    }


    public Integer getNodeStatus() {
        return nodeStatus;
    }

    /**
     * 节点状态（1在线；2离线，发生的时候的状态）
     **/
    public void setNodeStatus(LumlordLogService.BreakNodeStatus nodeStatus) {
        switch (nodeStatus) {
            case ZX:
                this.nodeStatus = 1; break;
            case LX:
                this.nodeStatus = 2; break;
        }
    }


    public String getSourceIp() {
        return sourceIp;
    }

    public void setSourceIp(String sourceIp) {
        this.sourceIp = sourceIp;
    }


    public Integer getBrakLevel() {
        return brakLevel;
    }

    /**
     * 故障等级（1重大；2严重；3轻度；）
     **/
    public void setBrakLevel(LumlordLogService.BreakLevel brakLevel) {
        switch (brakLevel) {
            case ZD:
                this.brakLevel = 1;
                break;
            case YZ:
                this.brakLevel = 2;
                break;
            case QD:
                this.brakLevel = 3;
                break;
        }
    }


    public Integer getBrakType() {
        return brakType;
    }

    /**
     * 故障类型（1设备故障；2通讯故障；3回路故障；4灯具效果故障；5其他故障）
     **/
    public void setBrakType(LumlordLogService.BreakType breakType) {
        switch (breakType) {
            case SBGZ:
                this.brakType = 1;
                break;
            case TXGZ:
                this.brakType = 2;
                break;
            case HLGZ:
                this.brakType = 3;
                break;
            case DXGZ:
                this.brakType = 4;
                break;
            case QTGZ:
                this.brakType = 5;
                break;
        }
    }


    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }


    public Date getOccurredTime() {
        return occurredTime;
    }

    public void setOccurredTime(Date occurredTime) {
        this.occurredTime = occurredTime;
    }


    public Integer getIsRead() {
        return isRead;
    }

    public void setIsRead(Integer isRead) {
        this.isRead = isRead;
    }

    public String getAddDay() {
        return addDay;
    }

    public void setAddDay(String addDay) {
        this.addDay = addDay;
    }
    public Breakdown() {
        super();
    }

}